<div class="row">
	<div class="col-xs-12 col-md-12">
		<div class="widget">
			<div class="widget-header bg-blue">
				<i class="widget-icon fa fa-arrow-down"></i>
				<span class="widget-caption">用户列表</span>
				<div class="widget-buttons">
					<a href="#" data-toggle="maximize">
						<i class="fa fa-expand"></i>
					</a>
					<a href="#" data-toggle="collapse">
						<i class="fa fa-minus"></i>
					</a>
					<a href="#" data-toggle="dispose">
						<i class="fa fa-times"></i>
					</a>
				</div>
			</div>
			<div class="widget-body">
				<label>
					<select name="role" class="form-control input-sm role_select">
						{:fill_option($roleList)}
					</select>
				</label>
				<a onclick="save()" style="margin-left: 20px" class="btn btn-primary">
					<i class="fa fa-plus"></i>批量分配权限
				</a>

				<table id="Ystech-table" class="table table-bordered table-hover">
					<thead class="bordered-darkorange">
						<tr role="row">
							<th width="30px"><div class="checkbox" style="margin-bottom: 0px; margin-top: 0px;">
									<label style="padding-left: 4px;"> <input type="checkbox" class="Ystech-checkall colored-blue">
                                     <span class="text"></span>
									</label>                                    
                                </div></th>
							<th>ID</th>
							<th>名称</th>
							<th>角色</th>
						</tr>
					</thead>
					<tbody>
						<volist name="cache" id="vo">
							<tr id="{$vo.id}">
								<td>
									<div class="checkbox" style="margin-bottom: 0px; margin-top: 0px;">
										<label style="padding-left: 4px;">
											<input name="checkvalue" type="checkbox" class="colored-blue Ystech-check" value="{$vo.id}">
											<span class="text"></span>
										</label>
	                                </div>
								</td>
								<td class=" sorting_1">{$vo.id}</td>
								<td class=" ">{$vo.username}</td>
								<td class=" ">
									<span>
										{$vo.role_name}
									</span>
								</td>
							</tr>
						</volist>
												
					</tbody>
				</table>
				<div class="row DTTTFooter">
					{$page}
				</div>
			</div>
		</div>
	</div>
</div>
<!--面包屑导航封装-->
<div id="tmpbread" style="display: none;">{$breadhtml}</div>
<script type="text/javascript">
	setBread($('#tmpbread').html());
</script>
<!--/面包屑导航封装-->
<!--全选特效封装/全部删除-->
<script type="text/javascript">
	//全选
	var checkall=$('#Ystech-table .Ystech-checkall');
	var checks=$('#Ystech-table .Ystech-check');
	var trs=$('#Ystech-table tbody tr');
	$(checkall).on('click',function(){
		if($(this).is(":checked")){			
			$(checks).prop("checked","checked");
		}else{
			$(checks).removeAttr("checked");
		}		
	});

	function save(){
		var role_id = $(".role_select").find("option:selected").val();
		var user_ids = [];
		var toAjax = "{:U('editBindRole')}"
		$("input[type=checkbox][name=checkvalue]:checked").each(function(){
			user_ids.push($(this).parents("tr").attr("id"))
		});
		var data = {
			"role_id":role_id,
			"user_ids":user_ids
		}
		var callok = function(){
			$('#refresh-toggler').trigger('click');
			return false;
		};
		var callerr = function(){
			return false;
		};
		$.Ystech.ajax('post',toAjax,data,callok,callerr);
	}
	
</script>
<!--/全选特效封装-->